<?php

namespace app\api\model\merchant;

use think\facade\Log;
use think\Model;

class MerchantOrderBill extends Model
{


    public static function createLog($data): bool
    {

        try {
            self::startTrans();
            $order=self::where(['order_sn' => $data['order_sn']])->find();
            if($order){
                return true;
            }

            $add['order_sn']=$data['order_sn'];
            $add['merchant_id']=$data['merchant_id'];
            $add['money']=$data['money'];
            self::create($add);
            self::commit();
            return true;
        }catch (\Exception $e){
            self::rollback();
            Log::write($e->getMessage(),'error');
            return false;
        }

    }

}